using System;
using System.Collections.Generic;

namespace Flood.Log
{
	public class ShapePartsReplaced : IChange
	{
		private readonly IDictionary<int, Square> oldParts;
		private readonly Shape shape;
		private readonly Action<IDictionary<int, Square>> undoReplace;

		public ShapePartsReplaced(Shape shape, Action<IDictionary<int, Square>> undoReplace, IDictionary<int, Square> oldParts)
		{
			this.shape = shape;
			this.undoReplace = undoReplace;
			this.oldParts = oldParts;
		}

		#region IChange Members

		public Shape Shape
		{
			get { return shape; }
		}

		public void Undo()
		{
			undoReplace(oldParts);
		}

		#endregion
	}
}